home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performPolyBoolean.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.9 KB  |  130 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  13 January 1998
  22. //
  23. //  Description:
  24. //
  25. //
  26. //  Procedure Name:
  27. //      performPolyBoolean
  28. //
  29. //  Description:
  30. //        perform a boolean operation of the selected polygon objects
  31. //         
  32. //  Input Arguments:
  33. //        $option : Whether to set the options to default values.
  34. //  Return Value:
  35. //        command string iff $option==2
  36. //
  37.  
  38. proc setOptionVars (int $forceFactorySettings)
  39. {
  40.      if ($forceFactorySettings || !`optionVar -exists polyBooleanType`)
  41.         optionVar -intValue polyBooleanType 1;
  42. }
  43.  
  44. global proc performPolyBooleanSetup (string $parent, int $forceFactorySettings)
  45. {
  46.     setOptionVars($forceFactorySettings);
  47.     setParent $parent;
  48.     
  49.     int $val = `optionVar -query polyBooleanType`;
  50.     optionMenuGrp -edit -sl $val polyBooleanType;
  51. //    intSliderGrp -edit -value $val polyBooleanType;
  52. }
  53.  
  54. global proc performPolyBooleanCallback (string $parent, int $doIt)
  55. {
  56.     setParent $parent;
  57.     optionVar -intValue polyBooleanType
  58.         `optionMenuGrp -query -sl polyBooleanType`;
  59.     if ($doIt) {
  60.         performPolyBoolean 0;
  61.         addToRecentCommandQueue "performPolyBoolean 0" "PolyBoolean";
  62.     }
  63. }
  64.  
  65. proc polyBooleanOptions ()
  66. {
  67.     string $commandName = "performPolyBoolean";
  68.     string $callback = ($commandName + "Callback");
  69.     string $setup = ($commandName + "Setup");
  70.        
  71.     string $layout = getOptionBox();
  72.     setParent $layout;
  73.     setUITemplate -pushTemplate DefaultTemplate;
  74.     waitCursor -state 1;
  75.     
  76.     string $parent = `columnLayout -adjustableColumn 1`;
  77.  
  78. //    intSliderGrp -label "Operation" -min 1 -max 10 -s 1 polyBooleanType;
  79.     optionMenuGrp  -l "Operation" polyBooleanType;
  80.     menuItem -l "Union" BooleanUnionMenuItem;
  81.     menuItem -l "Difference" BooleanDifferenceMenuItem;
  82.     menuItem -l "Intersection" BooleanIntersectionMenuItem;
  83.     setParent -m ..;
  84.     optionMenuGrp -e -sl 1 polyBooleanType;
  85.  
  86.     waitCursor -state 0;
  87.     setUITemplate -popTemplate;
  88.        
  89.     string $applyBtn = getOptionBoxApplyBtn();
  90.     button -edit -label "Boolean"
  91.            -command ($callback + " " + $parent + " " + 1)
  92.         $applyBtn;
  93.     string $saveBtn = getOptionBoxSaveBtn();
  94.     button -edit 
  95.         -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
  96.         $saveBtn;
  97.     string $resetBtn = getOptionBoxResetBtn();
  98.     button -edit 
  99.         -command ($setup + " " + $parent + " " + 1)
  100.         $resetBtn;
  101.              
  102.     setOptionBoxTitle("Polygon Boolean Options");
  103.  
  104.     setOptionBoxHelpTag( "PolyBoolean" );
  105.  
  106.     eval (($setup + " " + $parent + " " + 0));      
  107.     showOptionBox();
  108. }
  109.  
  110. global proc string performPolyBoolean (int $option)
  111. {
  112.     string $cmd="";
  113.     string $sel[];
  114.     switch ($option) {
  115.     case 0:
  116.         setOptionVars(false);
  117.         int $ival = `optionVar -query polyBooleanType`;
  118.         $cmd = "polyBoolOp " + " -op " + $ival;
  119.         polyPerformAction $cmd o 0;
  120.         break;
  121.     case 1: polyBooleanOptions; break;
  122.     default:
  123.         setOptionVars(false);
  124.         int $ival = `optionVar -query polyBooleanType`;
  125.         $cmd = "polyBoolOp " + " -op " + $ival;
  126.         $cmd = ("polyPerformAction \"" + $cmd + "\" o 0");
  127.     }
  128.     return $cmd;
  129. }
  130.